package com.lantosec.hmrp.modules.monitor.controller;


import com.lantosec.hmrp.core.kit.Result;
import com.lantosec.hmrp.core.mvc.BaseController;
import com.lantosec.hmrp.modules.monitor.entity.PatrolDetailsEntity;
import com.lantosec.hmrp.modules.monitor.entity.PatrolEntity;
import com.lantosec.hmrp.modules.monitor.service.IMonitorPatrolService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 * 移动巡查控制器
 *
 * @author AutoCode
 * @since 2020-05-27
 */
@Api(value = "移动巡查控制器", tags = "移动巡查控制器")
@RestController
@RequestMapping("/monitor/patrol")
@Log4j2
public class MonitorPatrolController extends BaseController {

    @Autowired
    private IMonitorPatrolService service;

    @GetMapping("getPatrolList")
    @ApiOperation(value = "移动巡查完成率汇总")
    public Result<List<PatrolEntity>> getPatrolList(
            @ApiParam(value = "月份") @RequestParam(name = "month",required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year",required = false) String year
    ) {
        List<PatrolEntity> param = service.getPatrolList(month,year);
        return Result.ok(param);
    }

    @GetMapping("getPatrolListDetail")
    @ApiOperation(value = "移动巡查完成率明细")
    public Result<List<PatrolDetailsEntity>> getPatrolListDetail(
            @ApiParam(value = "月份") @RequestParam(name = "month",required = false) String month,
            @ApiParam(value = "年份") @RequestParam(name = "year",required = false) String year,
            @ApiParam(value = "部门id") @RequestParam(name = "deptId",required = false) String deptId) {
        List<PatrolDetailsEntity> param = service.getPatrolListDetail(month,year,deptId);
        return Result.ok(param);
    }

}
